<template>
  <div class="app-container">
    <!--<div style="overflow:hidden;">-->
      <!--<el-input size="small" class="search-btn" v-model="page.keyword" placeholder="用户名/手机"></el-input>-->
      <!--<el-button type="primary" plain size="small" @click="search"><i class="el-icon-search"></i>搜索</el-button>-->
    <!--</div>-->

    <!--<el-tabs v-model="activeName" @tab-click="handleClick">-->
    <!--<el-tab-pane :label="item.name" :name="item.id" v-for="(item,index) in thelabels" :key="index"></el-tab-pane>-->
    <!--</el-tabs>-->

    <el-table
      element-loading-text="Loading"
      highlight-current-row
      row-class-name="ele-table-row"
      :data="tableData"
      style="width: 100%">
      <el-table-column label="序号" width="60">
        <template slot-scope="scope">
          {{scope.$index + 1 + 10 * (page.number - 1)}}
        </template>
      </el-table-column>
      <el-table-column label="时间" min-width="100" show-overflow-tooltip>
        <template slot-scope="scope">
          {{scope.row.saveTime}}
        </template>
      </el-table-column>
      <el-table-column label="内容" min-width="100" show-overflow-tooltip>
        <template slot-scope="scope">
          {{scope.row.name}}
        </template>
      </el-table-column>
    </el-table>
    <!--分页-->
    <el-pagination
      @current-change="handleCurrentChange"
      background
      layout="prev, pager, next"
      :total="page.total">
    </el-pagination>
  </div>
</template>

<script>
  import { page } from '../../../../mixins/index'
  import { message_page } from '@/api'

  export default {
    mixins: [page],
    data() {
      return {
        tableData: [{}, {}]
      }
    },
    methods: {
      showPic(url) {
        this.$store.dispatch('PicPreview', url).catch()
      },
      search() {
        this.getInfo()
      },
      pass(id, val) {
        // const params = {
        //   id: id,
        //   content: { status: val }
        // }
        let text = ''
        if (val === 2) {
          text = '通过'
        } else if (val === 3) {
          text = '不通过'
        }
        this.$confirm(`确定要${text}吗？`, '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          // admin_merchant_activity_put(params).then(res => {
          //   this.dialogVisible = false
          //   console.log(res)
          //   this.$message({ type: 'success', message: '操作成功' })
          //   this.getInfo()
          //   // this.$router.go(-1)
          // })
        }).catch(() => {
          console.log('cancel pass')
          // this.$message({ type: 'warning', message: '放弃操作' })
        })
      },
      del(id) {
        // const params = {
        //   id: id
        // }
        this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          // admin_merchant_del(params).then(res => {
          //   console.log(res)
          //   this.$message({
          //     type: 'success',
          //     message: '删除成功!'
          //   })
          //   this.getInfo()
          // })
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消删除'
          })
        })
      },
      getInfo() {
        message_page(this.page).then(res => {
          console.log(res)
          this.tableData = res.content
          this.page.total = res.totalElements
        })
      },
      toDetail(id) {
        // this.$router.push({ name: 'merchantsManagementDetail', params: { id: id }})
      }
    },
    mounted() {
      this.getInfo()
    }
  }
</script>

<style lang="scss"  scoped>

</style>
